# Dreams have to come true after all
from comment.utils.serializers import BaseListSerializer

"""序列化"""


class BankCardListSerializer(BaseListSerializer):
    """银行卡列表序列化"""

    def to_dict(self):
        list = []
        for obj in self.data_list:
            list.append({

                'card_id': obj.bankInfoId,
                'cardNum': obj.bankCardNum,
                'bankName': obj.openingBank

            })
        return list
from comment.utils.serializers import BasePaginateSerializer
class DealRecordPaginateSerializer(BasePaginateSerializer):
    """交易记录列表的分页序列化"""

    def get_object(self, obj):
        return {
            'deal_date': obj.aDate.strftime("%Y-%m-%d"),
            'deal_type': obj.aType,
            "descrp": obj.aDescreption,
            "deal_amount": float(obj.aAmount),
            'aAfter_Money': float(obj.aAfterTradingMoney),
            'deal_status': '交易成功' if obj.aTransferStatus else '交易失败'
        }